<template>
  <div
    v-for="(item, index) in brandshow.brandproductarr"
    :key="index"
    class="brandhotimg"
  >
    <div class="logo">{{ brandshow.brandlogimg[index] }}</div>
    <el-card
      :body-style="{ padding: '0px' }"
      v-for="(ele, index) in item"
      :key="index"
      @click="  store.dispatch('goproductsellpage',ele.product_id)"
    >
      <img
        :src="`http://localhost:3001/${ele.product_picture}`"
        class="image"
      />
      <div style="padding: 14px">
        <div class="time">{{ ele.product_name }}</div>
        <div class="price">￥{{ ele.product_selling_price }}</div>
      </div>
    </el-card>
  </div>
</template>
  
  
  
  <script setup>
import { hotproductApi, brandApi } from "../api/goods";
import { ref, onMounted, reactive } from "vue";
import { useStore } from 'vuex'
const store = useStore()
let brandshow = reactive({
  brandlogimg: [
    "M.A.C",
    "COLORKEY",
    "花西子",
    "完美日记",
    "3CE",
    "INTO YOU",
    "JUDYDOLL",
  ],
  brandproductarr: [],
});
const getallhotproduct = async () => {
  for (let i = 1; i <= 7; i++) {
    let data = await hotproductApi(i);
    brandshow.brandproductarr.push(data.Product);
  }
};

getallhotproduct();
</script>
  
  <style scoped lang="less">
.brandhotimg {
  display: flex;
  justify-content: space-between;
  position: relative;
  transform: translateX(-50%);
  left: 50%;
  margin: 30px 0;
  padding: 20px;
  .logo {
    height: 480px;
    width: 250px;
    text-align: center;
    line-height: 480px;
    font-size: 40px;
    border: solid 1px #e4e7ed;
    border-radius: 4px;
  }
}

.button {
  padding: 0;
  min-height: auto;
}

.image {
  width: 320px;
  height: 400px;
  display: block;
}
.time {
  width: 290px;
  margin: 20px 0;
  text-align: center;
  overflow: hidden;
}
.price {
  color: #fd3f31;
  font-size: 20px;
  position: absolute;
  bottom: 2%;
  left: 50%;
  transform: translateX(-50%);
}
.el-card{
  position: relative;
}
</style>